﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.IO;
using System.Text;
using System.Resources;
using System.Reflection;

namespace GomeeSoft.src.classes
{
    public enum PagesInDiary
    {
        Login,
        Month,
        Schedule,
        Diary,
        Contact,
        Money,
        Car,
        Project,
        Data
    }

    public enum DateType
    {
        Sunday,
        Saturday,
        Holiday,
        Workday
    }

	static class Global
    {
        #region Global Variables
        public static string country = "KOR";
        #endregion

        #region Window Messages
        public const int WM_NCHITTEST = 0x84;
        public const int WM_GETMINMAXINFO = 0x24;
        public const int WM_SYSCOMMAND = 0x112;
        public const int WM_MOUSEMOVE = 0x200;

        public const int SC_MINIMIZE = 0xf020;
        public const int SC_MAXIMIZE = 0xf030;
        public const int SC_RESTORE = 0xf120;

        public const int HTBORDER = 18;
        public const int HTBOTTOM = 15;
        public const int HTBOTTOMLEFT = 16;
        public const int HTBOTTOMRIGHT = 17;
        public const int HTCAPTION = 2;
        public const int HTCLIENT = 1;
        public const int HTCLOSE = 20;
        public const int HTERROR = -2;
        public const int HTGROWBOX = 4;
        public const int HTHELP = 21;
        public const int HTHSCROLL = 6;
        public const int HTLEFT = 10;
        public const int HTMENU = 5;
        public const int HTMAXBUTTON = 9;
        public const int HTMINBUTTON = 8;
        public const int HTNOWHERE = 0;
        public const int HTREDUCE = 8;
        public const int HTRIGHT = 11;
        public const int HTSIZE = 4;
        public const int HTSYSMENU = 3;
        public const int HTTOP = 12;
        public const int HTTOPLEFT = 13;
        public const int HTTOPRIGHT = 14;
        public const int HTTRANSPARENT = -1;
        public const int HTVSCROLL = 7;
        public const int HTZOOM = 9;
        #endregion

        #region Resource Strings
        public const string DBPassword = "78628923";
        // User Control
        public const string UCLabelBackColor = "UCLabelBackColor";
        public const string UCLabelForeColor = "UCLabelForeColor";
        public const string UCButtonBackColor = "UCButtonBackColor";
        public const string UCButtonForeColor = "UCButtonForeColor";
        public const string UCButtonBorderLight = "UCButtonBorderLight";
        public const string UCButtonBorderDark = "UCButtonBorderDark";
        // Diary Page
        public const string UCLoginApplicationTextColor = "UCLoginApplicationTextColor";
        public const string UCLoginTitleTextColor = "UCLoginTitleTextColor";
        // Font
        public const string FontMicrosoftSansSerif = "Microsoft Sans Serif";
        public const string FontTahoma = "Tahoma";
        // Color
        public const string FromBackColor = "FormBackColor";
        public const string LogoBorderColor1 = "LogoBorderColor1";
        public const string LogoBorderColor2 = "LogoBorderColor2";
        public const string LogoTextColor = "LogoTextColor";
        public static string[] PageBorderLightColor = { "PageBorderLightColor1", "PageBorderLightColor2", "PageBorderLightColor3", "PageBorderLightColor4" };
        public static string[] PageBorderDarkColor = { "PageBorderDarkColor1", "PageBorderDarkColor2", "PageBorderDarkColor3", "PageBorderDarkColor4" };
        public static string[] SideMenuBorderColor = { "MenuBorderColor1", "MenuBorderColor2", "MenuBorderColor3" };
        public static string[] SideMenuBackColor = { "MenuBackColor1", "MenuBackColor2", "MenuBackColor3", "MenuBackColor4", "MenuBackColor5", "MenuBackColor6", "MenuBackColor7", "MenuBackColor8" };
        public static string[] PopupWindowBorderLightColor = { "PopupWindowBorderLightColor1", "PopupWindowBorderLightColor2", "PopupWindowBorderLightColor3" };
        public static string[] PopupWindowBorderDarkColor = { "PopupWindowBorderDarkColor1", "PopupWindowBorderDarkColor2", "PopupWindowBorderDarkColor3" };
        public const string PopupWindowTitleColor = "PopupWindowTitleColor";
        public static string[] PageHeaderLineColor = { "PageHeaderLineColor1", "PageHeaderLineColor2", "PageHeaderLineColor3" };
        public const string MonthPageCalendarBackColor = "MonthPageCalendarBackColor";
        public static string[] MonthPageCalendarBorderColor = { "MonthPageCalendarBorderColor1", "MonthPageCalendarBorderColor2" };
        public const string MonthPageDateBackColorSunday = "MonthPageDateBackColorSunday";
        public const string MonthPageDateBackColorSaturday = "MonthPageDateBackColorSaturday";
        public const string MonthPageDateBackColorWorkday = "MonthPageDateBackColorWorkday";
        public const string MonthPageDateForeColorSunday = "MonthPageDateForeColorSunday";
        public const string MonthPageDateForeColorSaturday = "MonthPageDateForeColorSaturday";
        public const string MonthPageDateForeColorWorkday = "MonthPageDateForeColorWorkday";
        public const string MonthPageLunarDateForeColor = "MonthPageLunarDateForeColor";
        // Strings
        public static string DatabaseDirectory;
        public static Boolean designMode = true;
        public static string[] StringMenu = { GomeeSoft.Properties.Resources.StringMenuMonth,
                                              GomeeSoft.Properties.Resources.StringMenuSchedule,
                                              GomeeSoft.Properties.Resources.StringMenuDiary,
                                              GomeeSoft.Properties.Resources.StringMenuContact,
                                              GomeeSoft.Properties.Resources.StringMenuMoney,
                                              GomeeSoft.Properties.Resources.StringMenuCar,
                                              GomeeSoft.Properties.Resources.StringMenuProject,
                                              GomeeSoft.Properties.Resources.StringMenuData };
        #endregion

        #region Common Functions
        public static Color GetColor(string resourceColorName)
        {
            string colorSetting = GomeeSoft.Properties.Resources.ResourceManager.GetString(resourceColorName);
            int[] colorSettingInt = colorSetting.Split(',').Select(x => int.Parse(x)).ToArray<int>();
            return Color.FromArgb(colorSettingInt[0], colorSettingInt[1], colorSettingInt[2]);
        }
        public static PagesInDiary GetPagesInDiaryByIndex(int i)
        {
            switch (i)
            {
                case 0:
                    return PagesInDiary.Month;
                case 1:
                    return PagesInDiary.Schedule;
                case 2:
                    return PagesInDiary.Diary;
                case 3:
                    return PagesInDiary.Contact;
                case 4:
                    return PagesInDiary.Money;
                case 5:
                    return PagesInDiary.Car;
                case 6:
                    return PagesInDiary.Project;
                case 7:
                    return PagesInDiary.Data;
                default:
                    return PagesInDiary.Login;
            }
        }
        public static string GetDatabaseDirectory()
        {
            DatabaseDirectory = Directory.GetCurrentDirectory();
            DatabaseDirectory = Directory.GetParent(DatabaseDirectory).ToString();
            DatabaseDirectory = Directory.GetParent(DatabaseDirectory).ToString();
            DatabaseDirectory += "\\databases\\GomeeSoft.db";

            return DatabaseDirectory;
        }
        #endregion
    }
}
